<template>
	<!-- #ifndef APP-NVUE || MP-TOUTIAO -->
	<view class="u-demo-block">
		<!-- <text class="u-demo-block__title">卡片式</text> -->
		<u-swiper
			:list="imgList"
			circular
			:autoplay="true"
			radius="10"
			bgColor="#ffffff"
			:indicator="indicator"
			:indicator-mode="indicatorMode"
			:height="height"
			@click="previewImage"
		></u-swiper>
	</view>
	<!-- #endif -->
</template>

<script>
export default {
	data() {
		return {};
	},
	props: {
		indicator: {
			type: Boolean,
			default: false
		},
		indicatorMode: {
			type: String,
			default: 'dot'
		},
		height: {
			type: String | Number,
			default: 130
		},
		allowClick: {
			type: Boolean,
			default: false
		},
		imgList: {
			type: Array
		}
	},
	methods: {
		previewImage(index) {
			if (this.allowClick) {
				const url = this.imgList[index];
				uni.previewImage({
					current: url,
					urls: this.imgList
				});
			}
		}
	},
	mounted() {}
};
</script>
